import request from '@/utils/request'

export function existCourseCatalogByPid(params) { // 检测有没有子级
  return request({
    url: '/course/manage/existCourseCatalogByPid',
    method: 'get',
    params
  })
}

// 获取课程信息
export const courseDetail = params => {
  return request({
    url: '/course/manage/selectCourseById',
    method: 'post',
    data: params
  })
}

// 删除课程
export const deleteCourseById = params => {
  return request({
    url: '/course/manage/deleteCourseById',
    method: 'post',
    data: params
  })
}

// 课程目录树
export const treeCourseCataloglist = params => {
  return request({
    url: '/course/manage/treeCourseCataloglist',
    method: 'post',
    data: params
  })
}
// 备课时点击课程获取到教材文档
// export const getCourseDocFilePath = params => {
//   console.log(params)
//   return request({
//     url: '/course/manage/selectCourseById',
//     method: 'post',
//     data: params
//   })
// }

export function getCourseDocFilePath(data) { // 老师备授课前获取课程列表
  console.log(data)

  return request({
    url: '/course/manage/selectCoursePathById',
    method: 'post',
    data: { 'courseId': data }
  })
}

export function selectCourseFileList(params) { // 课程资料查询
  return request({
    url: '/course/manage/selectCourseFileList',
    method: 'get',
    params
  })
}

// 课程章节课时目录的资料上传
export const addCourseFile = params => {
  return request({
    url: '/course/manage/addCourseFile',
    method: 'post',
    data: params
  })
}

// 课程章节课时目录的资料上传
export const editCourseFile = params => {
  return request({
    url: '/course/manage/editCourseFile',
    method: 'post',
    data: params
  })
}

export function deleteCourseFile(params) { // 课程资料删除
  return request({
    url: '/course/manage/deleteCourseFile',
    method: 'post',
    data: params
  })
}
